home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-02 / turkit01.zip / TURSHOW.PAS < prev    next >
Pascal/Delphi Source File  |  1993-04-30  |  5KB  |  161 lines

  1. {*********************************************************}
  2. {                                                         }
  3. { NAPLPS Unit Demo                                        }
  4. { Copyright (c) 1993 Software @ Work, All Rights Reserved }
  5. { Copyright (c) 1993 Shawn Rhoads, All Rights Reserved    }
  6. {                                                         }
  7. {*********************************************************}
  8.  
  9. {$F+,O-,A+,B-,E+,L+,N+,V-,G+}  { to for 8086 use G- }
  10. {$M 65520,0,100000}
  11.  
  12. {$DEFINE NoDebug}
  13.  
  14. {$IFDEF Debug}
  15. {$R+,S+,D+,L+}
  16. {$ELSE}
  17. {$R-,S-,D-,L-}
  18. {$ENDIF}
  19.  
  20. Program TurShow;
  21.  
  22. Uses  unaplps, crt;
  23.  
  24. var i, startclock, endclock, filesze: longint;
  25.     secs: real;
  26.     j: integer;
  27.     filename: string[80];
  28.     dispfile: file;
  29.     outbuf: string;
  30.     a: array[1..300] of byte;
  31.     ch: char;
  32.     baudrate, byteon: longint;
  33.     botched, nostat: boolean;
  34.  
  35. Function Value(s:string):longint;
  36.  
  37. var e:integer;
  38.     j: longint;
  39.  
  40. begin
  41.   val(s,j,e);
  42.   value:=j;
  43. end;
  44.  
  45. Function Up(C:String):String;
  46.  
  47. Var
  48.   A: String;
  49.   I: Integer;
  50.  
  51. Begin
  52.   A:='';
  53.   For I:=1 to Length(C) do
  54.     A:=A+UpCase(C[i]);
  55.   Up:=A;
  56. End;
  57.  
  58. begin
  59.   filename:='<no file specified>  Use "TurShow <filename>"';
  60.   botched:=false;
  61.   writeln;
  62.  
  63.   if paramcount = 0 then begin
  64.     writeln('TurShow v1.06 (c) Copyright 1993 Shawn Rhoads, ALL RIGHTS RESERVED');
  65.     writeln('              (c) Copyright 1993 Software @ Work, ALL RIGHTS RESERVED');
  66.     writeln;
  67.     writeln('NAPLPS Viewer Program.  Requires CGA or better.');
  68.     writeln(' Use format:  TURSHOW <filename> <options>');
  69.     writeln;
  70.     writeln(' <filename> is NAPLPS frame you wish to display.');
  71.     writeln(' <options>:  -CGA     Display in CGA 320x200x4   mode.  (Default CGA)');
  72.     writeln('             -EGA     Display in EGA 640x350x16  mode.  (Default EGA)');
  73.     writeln('             -VGA     Display in VGA 640x480x16  mode.  (Default VGA)');
  74.     writeln('             -SVGA    Display in SVGA 320x200x256 mode.');
  75.     writeln('             -SVGA1   Display in SVGA 640x400x256 mode.');
  76.     writeln('             -SVGA2   Display in SVGA 640x480x256 mode.');
  77.     writeln('             -SVGA3   Display in SVGA 800x600x256 mode.');
  78.     writeln('             -SVGA4   Display in SVGA 1024x768x256 mode.');
  79.     writeln('             -SVGA5   Display in SVGA 640x350x256 mode.');
  80.     writeln('             -SVGA6   Display in SVGA 1028x1024x256 mode.');
  81.     writeln('             -CBIOS   Use your BIOS routines for color writes.');
  82.     writeln('             -B<baud> Display at <baud> baudrate.  Ex: -b2400');
  83.     writeln('             -NoStat  Supress the displaying of statistics.');
  84.     writeln;
  85.     writeln('For more information on this program, call the TurBoard BBS Support');
  86.     writeln('system at: 404/395-6326.');
  87.     halt(0);
  88.   end;
  89.  
  90.   baudrate:=0;
  91.   byteon:=0;
  92.   nostat:=false;
  93.   for i:=1 to paramcount do begin
  94.     if pos('-B',up(paramstr(i)))>0 then
  95.       baudrate:=value(copy(paramstr(i),3,length(paramstr(i))-2)) else
  96.     if pos('-CGA',up(paramstr(i)))>0 then displaytype:=1 else
  97.     if pos('-EGA',up(paramstr(i)))>0 then displaytype:=3 else
  98.     if pos('-SVGA',up(paramstr(i)))>0 then begin
  99.       svgaflag:=true;
  100.       svgamode:=value(copy(paramstr(i),6,length(paramstr(i))-5));
  101.       if (svgamode<0) or (svgamode>6) then svgamode:=0;
  102.     end else
  103.     if pos('-VGA',up(paramstr(i)))>0 then displaytype:=9 else
  104.     if pos('-CBIOS',up(paramstr(i)))>0 then bioscolor:=true else
  105.     if pos('-NOSTAT',up(paramstr(i)))>0 then nostat:=true else
  106.     filename:=up(paramstr(i));
  107.   end;
  108.  
  109.     writeln('TurShow NAPLPS (c) Copyright 1993 Shawn Rhoads, ALL RIGHTS RESERVED');
  110.     writeln('               (c) Copyright 1993 Software @ Work, ALL RIGHTS RESREVED');
  111.     i:=tenths;
  112.     while (tenths-i<15) and (i<=tenths) do ;
  113.  
  114.     assign(dispfile,filename);
  115.     {$I-} reset(dispfile,1) {$I+};
  116.     if ioresult<>0 then begin
  117.       writeln('Unable to open file:  ',filename);
  118.       halt(1);
  119.     end else begin
  120.       turnnapon;
  121.       startclock:=tenths;
  122.       repeat
  123.         blockread(dispfile,a,20,j);
  124.         outbuf:='';
  125.         for i:=1 to j do ansiwrite(chr(a[i]));
  126.         if baudrate>0 then begin
  127.           byteon:=byteon+j;
  128.           while ((100*byteon) div (tenths-startclock))>baudrate do
  129.             napcursor;
  130.         end;
  131.         napcursor;
  132.       until (j=0) or keypressed;
  133.       endclock:=tenths;
  134.       filesze:=filesize(dispfile);
  135.       close(dispfile);
  136.       if keypressed then botched:=true;
  137.       i:=tenths;
  138.       ch:=#255;
  139.       while (tenths-i<200) and (i<=tenths) and not keypressed do napcursor;
  140.       while keypressed do ch:=readkey;
  141.       turnnapoff;
  142.       clrscr;
  143.       if not nostat then begin
  144.         writeln('TurShow NAPLPS Statistics:');
  145.         writeln;
  146.         if botched then begin
  147.           writeln('Display aborted, no statistics available.');
  148.         end else begin
  149.           secs:=1.0 * (endclock-startclock) / 10;
  150.           writeln('Time to display file: ',secs:0:1,' seconds.');
  151.           writeln('        Size of file: ',filesze,' bytes');
  152.           if secs<>0 then
  153.           writeln('Simulated Throughput: ',((100*filesze) div
  154.             (endclock-startclock)):0,' BAUD');
  155.           writeln;
  156.         end;
  157.         writeln('Thanks for using TurShow!');
  158.       end;
  159.     end;
  160.  
  161. end.